<div>
	<h2 style='text-align:center'>添加砍价商品</h2>

	<div>
		<div>选择商品：</div>
		<div>
			<select id="FreeCon_AddGoodsList" style='width:100%'>
				<!--option value=""><div>aaaaaaaaassdfsdfdfsdfs</div>　234.00元　No.234</option-->
			</select>
		</div>
		<div style='margin:20px auto;text-align:center'>
			<button id="FreeConAddFreeBtn">提交</button>
			<button id="FreeConAddFreeBackBtn">返回</button>
		</div>
	</div>

</div>


<script>
	//C(StoreInfo);


	//获取常态且未关联过的普通商品列表 ,并解析到下拉框 
	Ajax2({type:'GetNormalGoodsList',store_id:StoreInfo.id},function(res){
		if(!/^\[{"id":.*$/.test(res)){
			$('#FreeCon_AddGoodsList,#FreeConAddFreeBtn').hide();
			return;
		}
		var info = JSON.parse(res);
		var str = '';
		for(var i=0;i<info.length;i++){
			str += "<option value='"+info[i].id+"'><div>No."+info[i].number+"　"+info[i].price+"元　"+info[i].title+"</option>";
		}
		$('#FreeCon_AddGoodsList').html(str);

		$('#FreeConAddFreeBtn').click(function(){
			var goods_id = $('#FreeCon_AddGoodsList').find('option:selected').val();
			var store_id = StoreInfo.id;
			if(!goods_id || !store_id){
				A('缺少参数！');
				return;
			}
			Ajax2({type:'FreeGoodsAdd',store_id:store_id,goods_id:goods_id},function(res){
				if(res == 'ok'){
					A('操作成功！');
					LoadPage();
				}
			},after_url);
		});
	},after_url);

	//返回
	$('#FreeConAddFreeBackBtn').click(function(){
		LoadPage();
	});	
</script>